package com.cqkjxy.utils;

import com.cqkjxy.entity.StaffEntity;
import com.cqkjxy.service.StaffService;

import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;

public final class SetUtils {
    /* *
     * @description setEqual:判断两个员工类集合是否相同
     * @author yang tao
     * @date 2021-12-23 13:48
     * @Param: original
     * @Param: updated
     * @return 返回updated中有但是original中没有的staff。
     */
    public static Set setEqual(Set<StaffEntity> original, Set<StaffEntity> updated) {
        Set set = new HashSet<StaffEntity>();
        Iterator<StaffEntity> or = original.iterator();
        Iterator<StaffEntity> up = updated.iterator();
        while (up.hasNext()) {
            StaffEntity next = up.next();
            if (!original.contains(next)) {
                set.add(next);
            }
        }
        return set;
    }

}
